﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace WebService.WebCommon
{
    /// <summary>
    /// 异常捕获
    /// </summary>
    public class AnomalyCapture :HandleErrorAttribute
    {
        public static Queue<Exception> ErrorQueue = new Queue<Exception>();
        /// <summary>
        /// 捕获异常数据
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnException(ExceptionContext filterContext)
        {
            base.OnException(filterContext);
            Exception ex = filterContext.Exception;
            ErrorQueue.Enqueue(ex);
            filterContext.HttpContext.Response.Redirect("/Error.html");
        }
    }
}